import 'package:find_friend/network/network.dart';
import 'package:find_friend/pages/mine/model/clothmodel.dart';
import 'package:find_friend/pages/mine/view/mine_dress_widget.dart';
import 'package:flutter/material.dart';

class MineClothesPage extends StatefulWidget {
  @override
  _MineClothesPageState createState() => _MineClothesPageState();
}

class _MineClothesPageState extends State<MineClothesPage> {

  ResponseCloth response;

  @override
  void initState() {
    super.initState();

    _request();
  }

  void _request(){
    Networktool.request(API.clothing, method: NETWORKHTTPMethod.GET,success: (data){
      if(data != null) {
        response = ResponseCloth.fromJson(data);
        if(mounted) setState(() { });
      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Expanded(
            child: Container(
              decoration: BoxDecoration(
                image: DecorationImage(image: AssetImage("assets/jia.png"), fit: BoxFit.cover),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  AppBar(
                    backgroundColor: Colors.transparent,
                    elevation: 0,
                    title: Text("我的装扮"),
                    centerTitle: true,
                    leading: IconButton(
                      onPressed: (){
                        Navigator.of(context).pop();
                      },
                      icon: Image.asset("assets/fanhui.png"),
                    ),
                  ),
                  Image.asset("assets/mm.png", fit: BoxFit.scaleDown,),
                ],
              ),
            ),
          ),
          MineChooseDressWidget(response: response,)
        ],
      ),
    );
  }
}